<template>
  <view class="container">
    <view class="info-title">
      <h2 style="" class="title">{{data.title}}</h2>
    </view>
    <view class="info-title">
      <text class="info-label">新闻内容:</text>
      <text class="info-value">{{data.content}}</text>
    </view>
    <view class="info-title">
      <text class="info-label" style="margin: 10px;"></text>
      <text class="info-value" id="date">{{data.date}}</text>
    </view>
    <view class="info-title">
      {{data.type}}
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        data: {

        }
      }
    },
    methods: {

    },
    onLoad(e) {
      let id = e.id
      uni.request({
        url: 'http://localhost:8090/foodapp/news/findone',
        method: 'POST',
        data: {
          id: id
        },
        success: res => {
          this.data = res.data.data
        },
        fail: () => {},
        complete: () => {}
      });
    }
  }
</script>

<style>
  .container {
    background-color: #f7f7f7;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
  }

  .info-title {
    padding: 10px;
  }

  .title {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
  }

  .info-label {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
  }

  .info-value {
    font-size: 16px;
    color: #333;
  }

  #date {
    position: absolute;
    right: 10px;
  }
</style>